package com.zl.tby.vo;

import com.zl.tby.model.TbyUavInfo;
import lombok.Data;
import org.noear.solon.validation.annotation.Length;
import org.noear.solon.validation.annotation.NotBlank;

import java.math.BigDecimal;

/**
 * 无人机信息
 * @author changpeng
 * @version 1.0
 * @since 2024/8/19 19:17
 */
@Data
public class TbyUavInfoForm {
    private Long id;
    /**编号*/
    @NotBlank(message = "编号不能为空")
    @Length(max = 32, message = "编号最大长度为32")
    private String code;
    /**设备id*/
    @NotBlank(message = "设备id不能为空")
    @Length(max = 255, message = "设备id最大长度为255")
    private String deviceId;
    /**名称*/
    @NotBlank(message = "名称不能为空")
    @Length(max = 20, message = "名称最大长度为20")
    private String name;
    /**型号*/
    @NotBlank(message = "型号不能为空")
    @Length(max = 20, message = "型号最大长度为20")
    private String model;
    /**飞行次数*/
    private Long flightCount;
    /**飞行里程*/
    private BigDecimal flightDistance;
    /**飞行时长*/
    private BigDecimal flightTime;
    /**责任人*/
    @Length(max = 255, message = "责任人最大长度为255")
    private String headName;
    /**联系方式*/
    @Length(max = 255, message = "联系方式最大长度为20")
    private String phone;
    /**在线状态*/
    private Integer status;
    /**最后出现的位置*/
    private String lonLat;

    public TbyUavInfo createEntity() {
        TbyUavInfo entity = new TbyUavInfo();
        entity.setCode(this.getCode());
        entity.setDeviceId(this.getDeviceId());
        entity.setName(this.getName());
        entity.setModel(this.getModel());
        entity.setHeadName(this.getHeadName());
        entity.setPhone(this.getPhone());
        entity.setStatus(0);
        return entity;
    }

    public void updateEntity(TbyUavInfo entity) {
        entity.setCode(this.getCode());
        entity.setDeviceId(this.getDeviceId());
        entity.setName(this.getName());
        entity.setName(this.getName());
        entity.setModel(this.getModel());
        entity.setHeadName(this.getHeadName());
        entity.setPhone(this.getPhone());
    }

    public void updateData(TbyUavInfo entity) {
        entity.setId(this.getId());
        entity.setFlightCount(this.getFlightCount());
        entity.setFlightTime(this.getFlightTime());
        entity.setFlightDistance(this.getFlightDistance());
    }
}
